package com.yalantis.euclid.domains;


/**
 * @author Guo
 * @Date 2018年5月2日
 * 情绪指标
 */
public class Emotion {
    /**高兴*/
    private double happy;
    /**生气*/
    private double angry;
    /**悲伤*/
    private double sad;
    /**
     * Function:获取Emotion中比重最大的情绪值
     * @return
     */
    public double getBiggestValue(){
        double value = 0;
        switch (getBiggestPart().split(" ")[0]) {
            case "happy":
                value = happy;
                break;
            case "angry":
                value = angry;
                break;
            case "sad":
                value = sad;
                break;
        }
        return value;
    }
    /**
     * Function:获取Emotion中比重最大的情绪名称
     * @return
     */
    public String getBiggestPart(){
        String str = "";
        if (happy > angry) {
            str= "happy";
            if (sad > happy) {
                str = "sad";
            }else if (sad == happy) {
                str += " sad";
            }
        }else if (happy == angry) {
            str = "happy angry";
            if (sad > happy) {
                str = "sad";
            }else if (sad == happy) {
                str += " sad";
            }
        }else{
            str = "angry";
            if (sad > angry) {
                str = "sad";
            }else if (sad == angry) {
                str += " sad";
            }
        }
        return str;
    }
    @Override
    public String toString() {
        return "\t开心:"+(int)(100*happy)+"%\n"+"\t生气:"+(int)(100*angry)+"%\n"+"\t伤心:"+(int)(100*sad)+"%";
    }
    public double getHappy() {
        return happy;
    }
    public void setHappy(double happy) {
        this.happy = happy;
    }
    public double getAngry() {
        return angry;
    }
    public void setAngry(double angry) {
        this.angry = angry;
    }
    public double getSad() {
        return sad;
    }
    public void setSad(double sad) {
        this.sad = sad;
    }
    public Emotion(double happy, double angry, double sad) {
        super();
        this.happy = happy;
        this.angry = angry;
        this.sad = sad;
    }
    public Emotion() {
    }
}